<template>
   <div class="newInfo_content">
       <h2 class="title">{{newInfo.title}}</h2>
       <p class="subtitle">
           <span>发布时间:{{newInfo.add_time|dataFormat}}</span>
           <span>点击次数:{{newInfo.click}}</span>
       </p>
       <hr>
       <div class="content" v-html="newInfo.content"></div>
   </div>
</template>
<script>
import {Toast}from 'mint-ui'
    export default{
    data(){
        return {
            id:this.$route.params.id,
            newInfo:{}
        }
    },
    created() {
        this.getNewsInfo()
    },
    methods:{
        getNewsInfo(){
            this.$http.get('api/getnew/'+this.id).then(result=>{
                if(result.body.status===0){
                    this.newInfo=result.body.message[0]
                }else{
                    Toast('获取新闻详情失败！')
                }
            })
        }
    }
    }
</script>
<style lang="less" >
.newInfo_content{
    padding:0 8px;
    .title{
        font-size: 16px;
        color:red;
        margin:15px 0;
        text-align: center;
    }
    .subtitle{
        display: flex;
        justify-content: space-between;
        font-size: 13px;
        color: #229aff;
    }
    .content{
        img{
            width: 100%;
        }
    }
}
</style>
